


const pagePahtConfig : Record<string, string> = {
	indexListPage: "pages/index/index",
	eventCreateEditPage: "pages/home/eventCreateEditPage/eventCreateEditPage",
	eventListPage: "pages/more/home/eventListPage/eventListPage",
	eventDetailPage: "pages/more/home/eventDetailPage/eventDetailPage",
	labelCreateEditPage: "pages/more/label/labelCreateEditPage/labelCreateEditPage",
	labelListPage: "pages/more/label/labelListPage/labelListPage",
	labelDetailPage: "pages/more/label/labelDetailPage/labelDetailPage",
	categoryCreateEditPage: "pages/more/category/categoryCreateEditPage/categoryCreateEditPage",
	categoryListPage: "pages/more/category/categoryListPage/categoryListPage",
	categoryDetailPage: "pages/more/category/categoryDetailPage/categoryDetailPage",
	agentCreateEditPage: "pages/more/agent/agentCreateEditPage/agentCreateEditPage",
	agentListPage: "pages/more/agent/agentListPage/agentListPage",
	agentDetailPage: "pages/more/agent/agentDetailPage/agentDetailPage",
	entryCreateEditPage: "pages/more/entry/entryCreateEditPage/entryCreateEditPage",
	entryListPage: "pages/more/entry/entryListPage/entryListPage",
	entryDetailPage: "pages/more/entry/entryDetailPage/entryDetailPage",
	planCreateEditPage: "pages/more/plan/planCreateEditPage/planCreateEditPage",
	planListPage: "pages/more/plan/planListPage/planListPage",
	planDetailPage: "pages/more/plan/planDetailPage/planDetailPage",
	planSegCreateEditPage: "pages/more/planSeg/planSegCreateEditPage/planSegCreateEditPage",
	planSegListPage: "pages/more/planSeg/planSegListPage/planSegListPage",
	planSegDetailPage: "pages/more/planSeg/planSegDetailPage/planSegDetailPage",
	addrCreateEditPage: "pages/more/addr/addrCreateEditPage/addrCreateEditPage",
	addrListPage: "pages/more/addr/addrListPage/addrListPage",
	addrDetailPage: "pages/more/addr/addrDetailPage/addrDetailPage",
};


/**
 * 页面路径配置数据。
 * 当页面路径有变化时必须同步更新这里的配置。
 */
export class PagesPath {
	public static getPath(
		key : 'label' | 'event' | 'weather' | 'planSeg' | 'plan' | 'favorite' | 'entry' | 'agent' | 'addr' | 'category',
		type : 'create' | 'edit' | 'list' | 'detail',
		id ?: string
	) {
		const restKey = type === 'list' ? 'ListPage' : type === 'detail' ? 'DetailPage' : 'CreateEditPage';
		const prop = key + restKey;
		if (!pagePahtConfig[prop]) {
			return '';
		}
		const paramsArr : string[] = [];
		if (type === 'create' || type === 'edit') {
			paramsArr.push('type=' + type);
		}
		if (id) {
			paramsArr.push('id=' + id);
		}
		const paramStr = paramsArr.length ? '?' + paramsArr.join('&') : '';
		return '/' + pagePahtConfig[prop] + paramStr;
	}
};